
var timer=null;
var obj;
var index=0;
var left;
var li_width;
var li_length;
var my_dian;
timer=window.setInterval("autoChangePic()",2000);

function autoChangePic(){
	index++;
	obj=document.getElementById("slide");
	left = document.getElementById("pic_ul").offsetLeft;
	li_width = document.getElementById("pic_li").offsetWidth;
	li_length = document.getElementById("pic_ul").getElementsByTagName("li").length;
	my_dian = document.getElementById("index_pic_dian").getElementsByTagName("a");//获取到所有的点
	showPic(index);
	
	for(var i=0;i<my_dian.length;i++){
		my_dian.item(i).index=i;
		my_dian.item(i).onmouseover=function(){
			clearInterval(timer);
			index=this.index;
			showPic(this.index);	
		}
		my_dian.item(i).onmouseout=function(){
			clearInterval(timer);
			timer=window.setInterval("autoChangePic()",2000);
			if(index==2){
				index=-1;
			}
		}
	}
	if(index==2){
		index=-1;
	}
	
}

function showPic(num){
	//直接给索引即可
	
	$("#pic_ul").animate({left:-index*li_width},300);
	//点
	for(var i=0;i<my_dian.length;i++){//将所有的点的背景改为默认
		my_dian.item(i).className="dian_style";
	}
	
	my_dian.item(num).className="dian_style_1";//把当前索引点 改了背景蓝
}
/**
 * 跳转到FM页面
 */
function getInfo(){
	$.ajax({
		url:"json/FmArticleAction_getDatesArticle",
		dataType:"json",
		type:"post",
		success:function(data){
			if(data!=null){
				location.href="FM/FM_mentality.jsp";
			}
		}
	});
}
/**
 * 跳转到杂志页面
 */
function getArticleInfo(){
	$.ajax({
		url:"json/articleAction_findAllArticle",
		dataType:"json",
		type:"post",
		success:function(data){
			if(data!=null){
				location.href="article/article.jsp";
			}
		}
	});
}








